package com.rt.dao.impo;

import com.rt.dao.HeroDao;
import entity.hrio;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import util.com.Alipool;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.List;

public class impoDao implements HeroDao {
    QueryRunner dd=new QueryRunner();
    @Override
    public List getpager(int page) throws SQLException {

        String sql="select * from  bjbiao limit ?,3";
        int p=(page-1)*10;
        Connection conn= Alipool.getconn();
        List list=dd.query(conn,sql,new BeanListHandler<hrio>(hrio.class),p);
        conn.close();
        return list;
    }

    @Override
    public boolean qqzc账号(String st, String nar, String sfg) {
        String sql = "insert into bjbiao1(bjID,bjxmName,bzr) values(?,?,?)";
        try {
            Connection   conn = Alipool.getconn();
            PreparedStatement pst;
            pst = conn.prepareStatement(sql);
            pst.setString(1, st );
            pst.setString(2, nar);
            pst.setString(3, sfg);

          //  System.out.println("qwqwqwqwe12121221");
            int num = pst.executeUpdate();
            if (num > 0) {
                return true;
            } else {
                return false;
            }

        } catch (SQLException ex) {
            ex.printStackTrace();
            System.out.println("修改数据发生异常!");
        }
        return false;
    }

    public static void main(String[] args) {
        HeroDao daoq=new impoDao();
       // boolean list=daoq.qqzc账号(1, "12", "rt");
    }
}
